<?php
	header("Content-type: text/html; charset=utf-8");
	define('ALLOWGUEST',true);
	session_start();
	require_once './source/core/run.php';
	
	require_once 'data/include/Functions.php';
	require_once 'data/include/Cart.class.php';
	$cart = new Cart();
	$gid = $_POST['gid'];
	$gnum = $_POST['gnum'];		
	$sql	= "SELECT v.*,c.catename,c.img,c.cssname,c.target,c.linktype,c.linkurl FROM ".DB_PREFIX."product AS v".
         " LEFT JOIN ".DB_PREFIX."productcate AS c ON v.cateid=c.cateid".
	     " WHERE v.flag=1 AND v.productid='".intval($gid)."'";
	$product= $db->fetch_first($sql);
	$data=array(
      "id"=>$gid,                        
      "name"=>$product['productname'],         
      "num"=>$gnum,                       
      "price"=>$product['price']*$gnum,                
      'img'=>$product['img1']
	 );
	
	$cart->add($data);
	echo 1;
	die;
	
	
?>